/* ************************************************************************



************************************************************************ */

qx.Class.define("HersPOS.MidComp",
{
  //   extend : qx.ui.window.Composite,
  extend : qx.ui.container.Composite,

  events :
  {
    "reload"        : "qx.event.type.Event",
    "reload_selbox" : "qx.event.type.Event"
  },

  construct : function()
  {
    this.base(arguments);
    var layout = new qx.ui.layout.Grow();
    this.setLayout(layout);
    var midTab = new qx.ui.tabview.TabView();
    var SalesPage = new qx.ui.tabview.Page("Sales")
    var ItemsPage = new qx.ui.tabview.Page("Items")
    SalesPage.setLayout(new qx.ui.layout.Grow())
    ItemsPage.setLayout(new qx.ui.layout.Grow())

    //   this.setLayout(new qx.ui.layout.Grid())
//     this.setBackgroundColor("background-splitpane");

    this.setDecorator("main");
    this.setPadding(0);
//     layout.setSeparator("separator-horizontal");

    //   this.setWidth(Math.floor(qx.bom.Viewport.getWidth() * 0.12));
    this.LeftSalesTable = new HersPOS.SaleTableComp();
    this.RightItemTable = new HersPOS.ItemTableComp();

    SalesPage.setPadding([0,0,0,0])
    ItemsPage.setPadding([0,0,0,0])
    midTab.setPadding([0,0,0,0])
    
    SalesPage.add(this.LeftSalesTable, { flex : 1 });
    ItemsPage.add(this.RightItemTable, { flex : 1 });
    
    midTab.add(SalesPage,{ flex : 1 })
    midTab.add(ItemsPage,{ flex : 1 })
    this.add(midTab,{ flex : 1 })

    this.RightItemTable.addListener("reload_selbox", function()
    {
//       console.log("reloading reload_selbox");
      this.LeftSalesTable.SalesBar.productlist_store.reload();
    },
    this);
  }
});

//     this.botPart.exclude()